{% import os %}
{% from xutils import fsutil %}
{% init show_rename_file_link = True %}
{% init get_file_thumbnail = xutils.get_func_by_name("fs.get_file_thumbnail") %}
{% init get_file_download_link = xutils.get_func_by_name("fs.get_file_download_link") %}

<table class="table row">
    {% for fpath in pathlist %}
        {% set fname = os.path.basename(fpath) %}
        {% set display_name = fsutil.get_display_name(fpath, dirname) %}
        <tr>
            <td>
                <!-- <a href="{{fsutil.get_webpath(fpath)}}">{{display_name}}</a> -->
                <img class="fs-thumbnail x-photo" src="{{get_file_thumbnail(fpath)}}" 
                    data-src="{{get_file_download_link(fpath)}}" title="{{fname}}"/>
            </td>
            <td class="option-td">
                {{xutils.format_file_size(fpath)}}
            </td>
            <td class="option-td">
                <div class="float-right">
                    {% if show_rename_file_link %}
                        <a class="rename-btn" data-name="{{display_name}}">重命名</a>
                    {% end %}
                    <a href="{{get_file_download_link(fpath)}}">下载</a>
                    <a class="danger-link" data-path="{{fpath}}" data-name="{{display_name}}" 
                    onclick="xnote.action.fs.delete(this);">删除</a>
                </div>
            </td>
        </tr>
    {% end %}
</table>

{% include fs/component/script/file_op_script.html %}
